import { createRouter, createWebHistory } from 'vue-router'
import BasicLayout from "../layout/BasicLayout.vue";
import HomeLayout from "../layout/HomeLayout.vue";
const router = createRouter({
  history: createWebHistory(import.meta.env.BASE_URL),
  routes: [
    {
      path: '/',
      name: 'home',
      component: BasicLayout,
      redirect: '/login',
      children: [
        {
          path: '/mail',
          name: 'mail',
          component: HomeLayout,
          redirect: '/mail/home',
          children: [
            {
              path: 'home',
              name: 'mailHome',
              component: () => import('../views/HomePage.vue'),
              meta: { title: '首页 | BoHan邮箱' },
            },
            {
              path: 'setting',
              name: 'mailSetting',
              component: () => import('../views/setting/Index.vue'),
              meta: { title: '系统设置 | BoHan邮箱' },
            },
            {
              path: 'write',
              name: 'write',
              component: () => import('../views/WriteEmailComponent.vue'),
              meta: { title: '系统设置 | BoHan邮箱' },
            },
          ]
        },
        {
          path: '/login',
          name: 'login',
          component: () => import('../views/LoginPage.vue')
        },
        {
          path: '/register',
          name: 'register',
          component: () => import('../views/RegisterPage.vue')
        },
      ]
    },
  ]
})

export default router
